package com.schoolgard.entitybean;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "ALARM_LOG")
public class AlarmLog implements java.io.Serializable {
	private static final long serialVersionUID = -5500840673150244606L;
	private Long id;
	private AlarmClass alarmClass;
	private Device device;
	private Date datetime;
	private String content;
	private String status;
	private Long userId;
	private String userName;
	private Date confirmDatetime;
	private String router;

	@Id
	@Column(name = "ID", unique = true, nullable = false, precision = 10, scale = 0)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "SOURCE_GUID", nullable = false)
	public Device getDevice() {
		return device;
	}

	public void setDevice(Device device) {
		this.device = device;
	}
	
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "ALARM_CLASS_ID", nullable = false)
	public AlarmClass getAlarmClass() {
		return alarmClass;
	}

	public void setAlarmClass(AlarmClass alarmClass) {
		this.alarmClass = alarmClass;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "DATETIME")
	public Date getDatetime() {
		return this.datetime;
	}

	public void setDatetime(Date datetime) {
		this.datetime = datetime;
	}

	@Column(name = "CONTENT", length = 510)
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(name = "STATUS", length = 2)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Column(name = "USER_ID", precision = 10, scale = 0)
	public Long getUserId() {
		return this.userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	@Column(name = "USER_NAME", length = 64)
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "CONFIRM_DATETIME")
	public Date getConfirmDatetime() {
		return this.confirmDatetime;
	}

	public void setConfirmDatetime(Date confirmDatetime) {
		this.confirmDatetime = confirmDatetime;
	}

	@Column(name = "ROUTER", length = 1024)
	public String getRouter() {
		return this.router;
	}

	public void setRouter(String router) {
		this.router = router;
	}

}